package demo;

public class Account {
    private final String id;

    private double balance;

    public Account(String id, double balance) {
        this.id = id;
        this.balance = balance;
    }

    public String getId() {
        return id;
    }

    public double getBalance() {
        return balance;
    }

    @Override
    public String toString() {
        return "账户：" + id + ", 余额：" + balance;
    }
    public void save(double money){
        if (money>0){
            balance+=money;
            System.out.println("存款成功，当前余额为:"+balance);
        }else {
            System.out.println("请重新输入");
        }
    }
}
